package com.exam.Service;

import com.exam.Entity.Student;
import com.exam.Mapper.AnswerInfoMapper;
import com.exam.Mapper.AnswerMapper;
import com.exam.vo.AnswerVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QuestionService {

    @Autowired
    private AnswerMapper answerMapper;

    public List<AnswerVO> findTotal(int page, int size) {

        List<AnswerVO> result = answerMapper.findAll();

        return result;
    }
    public List<AnswerVO> findAll(int page,int size) {
        //设置分页参数
        PageHelper.startPage(page, size);
        //执行查询
        List<AnswerVO> result = answerMapper.findAll();
        // 包装分页结果
        PageInfo<AnswerVO> pageInfo = new PageInfo<>(result);

        return pageInfo.getList();
    }
}
